package gamefw.gameplugin;

import gamefw.framework.Coordinate;
import gamefw.uiplugin.IVisualResource;

/**
 * The Class represents a Game Entity. A game entity is some abstract entity that 
 * belongs to a game. It could be, for instance, a piece that is placed in a board
 * position. Each game entity should hold a concrete implementation of a VisualEntity.
 */
public abstract class GameEntity implements IVisualResourceProvider {
	
	private IVisualResource visualResource;
	
	private Coordinate position;
	
	private AbstractPlayer owner;

	/**
	 * Get visual entity.
	 * @return associated VisualEntity object
	 */
	public IVisualResource getVisualResource() {
		return visualResource;
	}

	/**
	 * Set the visual entity. Called by GameManager.
	 * @param visualResource VisualEntity object
	 */
	public void setVisualEntity(IVisualResource visualResource) {
		this.visualResource = visualResource;
	}
	
	/**
	 * Gets the current position
	 *
	 * @return the current position
	 */
	public Coordinate getPosition() {
		return position;
	}
	
	/**
	 * Sets the position of the entity in the board.
	 *
	 * @param position the new position
	 */
	public void setPosition(Coordinate position) {
		this.position = new Coordinate(position);
	}

	public AbstractPlayer getOwner() {
		return owner;
	}

	public void setOwner(AbstractPlayer owner) {
		this.owner = owner;
	}
}
